package com.fanbuchi.fukua.manager;

import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;

import com.fanbuchi.fukua.config.AppConfig;

/**
 * Created by killerzhangsan on 2015/5/21.
 * @title json数据转换管理
 */
public class MapperManager {

   static ObjectMapper mapper = new ObjectMapper();



    private static void configMapper(){
        if (AppConfig.DEBUG){
            mapper.configure(SerializationFeature.INDENT_OUTPUT,true);
        }
        mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
        mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
    }

    public static ObjectMapper getMapper() {
        configMapper();
        return mapper;
    }
}
